package uaiContacts.model;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Droog
 */
@Entity
@Table(name = "tb_tipo_logradouro", catalog = "sistema_ipi", schema = "public")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TipoLogradouro.findAll", query = "SELECT t FROM TipoLogradouro t"),
    @NamedQuery(name = "TipoLogradouro.findByIdTipoLogradouro", query = "SELECT t FROM TipoLogradouro t WHERE t.idTipoLogradouro = :idTipoLogradouro"),
    @NamedQuery(name = "TipoLogradouro.findByNomTipoLogradouro", query = "SELECT t FROM TipoLogradouro t WHERE t.nomTipoLogradouro = :nomTipoLogradouro")})
public class TipoLogradouro implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_tipo_logradouro", nullable = false)
    private Integer idTipoLogradouro;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 11)
    @Column(name = "nom_tipo_logradouro", nullable = false, length = 11)
    private String nomTipoLogradouro;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idTipoLogradouro")
    private List<Endereco> enderecoList;

    public TipoLogradouro() {
    }

    public TipoLogradouro(Integer idTipoLogradouro) {
        this.idTipoLogradouro = idTipoLogradouro;
    }

    public TipoLogradouro(Integer idTipoLogradouro, String nomTipoLogradouro) {
        this.idTipoLogradouro = idTipoLogradouro;
        this.nomTipoLogradouro = nomTipoLogradouro;
    }

    public Integer getIdTipoLogradouro() {
        return idTipoLogradouro;
    }

    public void setIdTipoLogradouro(Integer idTipoLogradouro) {
        this.idTipoLogradouro = idTipoLogradouro;
    }

    public String getNomTipoLogradouro() {
        return nomTipoLogradouro;
    }

    public void setNomTipoLogradouro(String nomTipoLogradouro) {
        this.nomTipoLogradouro = nomTipoLogradouro;
    }

    @XmlTransient
    public List<Endereco> getEnderecoList() {
        return enderecoList;
    }

    public void setEnderecoList(List<Endereco> enderecoList) {
        this.enderecoList = enderecoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idTipoLogradouro != null ? idTipoLogradouro.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TipoLogradouro)) {
            return false;
        }
        TipoLogradouro other = (TipoLogradouro) object;
        if ((this.idTipoLogradouro == null && other.idTipoLogradouro != null) || (this.idTipoLogradouro != null && !this.idTipoLogradouro.equals(other.idTipoLogradouro))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.TipoLogradouro[ idTipoLogradouro=" + idTipoLogradouro + " ]";
    }
    
}